document.write("<script language=javascript src='../webviewGroup.js'></script>");
document.write("<script language=javascript src='../mui.min.js'></script>");

mui.init();
mui.plusReady(function() {
	var _self = plus.webview.currentWebview();
	var group = new webviewGroup(_self.id, {
		items: [{
			id: "game.html",
			url: "../../views/home/game.html",
			styles: {
				top: "45px", //子页面顶部位置
			},
			extras: {}
		}, {
			id: "./benefitPlay.html",
			url: "../../views/home/benefitPlay.html",
			styles: {
				top: "45px", //子页面顶部位置
			},
			extras: {}
		}],
		onChange: function(obj) {
			var c = document.querySelector(".mui-control-item.mui-active");
			if(c) {
				c.classList.remove("mui-active");
			}
			var target = document.querySelector(".mui-scroll .mui-control-item:nth-child(" + (parseInt(obj.index) + 1) + ")");
			target.classList.add("mui-active");
			if(target.scrollIntoView) {
				target.scrollIntoView();
			}
		}
	});
	mui(".mui-scroll").on("tap", ".mui-control-item", function(e) {
		var wid = this.getAttribute("data-wid");
		group.switchTab(wid);
	});

});
mui.back = function() {
	var _self = plus.webview.currentWebview();
	_self.close("auto");
}